package cn.edu.lit.jsjxy.CourseExample.chapter3;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cn.edu.lit.jsjxy.CourseExample.R;

public class MainActivity_Chap3 extends Activity implements View.OnClickListener
{

    Button btnStartActivity, btnMenuTest, btnDialogTest,btnLifecycleTest;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main__chap3);

        btnStartActivity = findViewById(R.id.btnStartActivity);
        btnMenuTest = findViewById(R.id.btnMenuTest);
        btnDialogTest = findViewById(R.id.btnDialogTest);
        btnLifecycleTest = findViewById(R.id.btnLifecycleTest);

        btnStartActivity.setOnClickListener(this);
        btnMenuTest.setOnClickListener(this);
        btnDialogTest.setOnClickListener(this);
        btnLifecycleTest.setOnClickListener(this);
    }

    @Override
    public void onClick(View view)
    {
        switch (view.getId())
        {
            case R.id.btnStartActivity:
                Intent intent = new Intent(this,FirstActivity.class);
                startActivity(intent);
                break;
            case R.id.btnMenuTest:
                Intent intent1 = new Intent(this,MenuTestActivity.class);
                startActivity(intent1);
                break;
            case  R.id.btnDialogTest:
                Intent intent2 = new Intent(this, DialogTestActivity.class);
                startActivity(intent2);
                break;

            case  R.id.btnLifecycleTest:
                Intent intent3 = new Intent(this, LifeCycleTestActivity.class);
                startActivity(intent3);
                break;
        }
    }
}
